<?php
/**
 * Created by PhpStorm.
 * User: zhangrxiang
 * Date: 2016/11/2
 * Time: 11:01
 * Project name: PHPTEST
 * File name: 1.php
 * @copyright Copyright (c) 2016 ZRX Software LLC
 * @license https://github.com/zhangrxiang
 * @since 1.0.0
 */
$subject = array('1', 'a', '2', 'b', '3', 'A', 'B', '4');
$pattern = array('/\d/', '/[a-z]/', '/[1a]/');
$replace = array('A:$0', 'B:$0', 'C:$0');
echo "<pre>";
echo "preg_filter returns\n";
print_r(preg_filter($pattern, $replace, $subject));
//Array
//(
//    [0] => A:C:1
//    [1] => B:C:a
//[2] => A:2
//    [3] => B:b
//[4] => A:3
//    [7] => A:4
//)

echo "preg_replace returns\n";
print_r(preg_replace($pattern, $replace, $subject));
echo "</pre>";


echo PCRE_VERSION;
?>
